import React from 'react'
import {Modal,Input,Form} from 'antd'
import Avatar from '../../../components/upload';
const FormItem = Form.Item;
const { TextArea } = Input;
const formItemLayout = {
    labelCol: {
        span: 8,
    },
    wrapperCol: {
        span: 14,
    }
};
class AddRepairModal extends React.Component {

    render(){
        const { visible, onOk, onCancel,form} = this.props;
        // console.log(visible)
        const {getFieldDecorator} = form;
        // console.log(visible)
        return (
            <div>
                <Modal
                    title="新增报修"
                    visible={visible}
                    onOk={onOk}
                    onCancel={onCancel}
                    okText="确认"
                    cancelText="取消"
                >
                <Form>
                    <FormItem label="报修名称" {...formItemLayout}>
                        {getFieldDecorator('repairname', {
                            rules: [
                                { required: true, message: '报修名称不能为空' },
                            ],
                        })(
                            <Input placeholder='请输入报修名称'/>
                        )}
                    </FormItem>
                    <FormItem label="报修图片" {...formItemLayout}>
                        {getFieldDecorator('repairimgurl', {
                            rules: [
                                { required: true, message: '请上传报修图片' },
                            ],
                        })(
                            <Avatar avatarName="上传图片" imgPhoto={visible == true ? 1 : ''}/>
                        )}
                    </FormItem>
                    <FormItem label="报修内容" {...formItemLayout}>
                        {getFieldDecorator('repaircontent', {
                            rules: [
                                { required: true, message: '报修内容不能为空' },
                            ],
                        })(
                            <TextArea rows={4} placeholder="请输入报修内容" />
                        )}
                    </FormItem>
                    <FormItem label="地址" {...formItemLayout}>
                        {getFieldDecorator('position', {
                            rules: [
                                { required: true, message: '地址不能为空' },
                            ],
                        })(
                            <Input rows={4} placeholder="请输入地址" />
                        )}
                    </FormItem>
                </Form>
            </Modal>
        </div>
        )
    }
}
export default Form.create()(AddRepairModal)
